package com.chennan.spring.demo.annotation.lazy;

import com.chennan.spring.modal.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;

/**
 * @author chennan
 * @create 2021-11
 */
@Configuration
public class MyLazyConfig {
    /**
     * 延迟加载 默认非延迟加载
     * 延时加载只针对单例Bean起作用
     * 容器启动不创建对象
     * @return
     */
    @Lazy
    @Bean("personlazy")
    public Person person(){
        return new Person();
    }


}
